﻿using Conqueror.API;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;

namespace Conqueror.WP.ViewModel.Matchmaking
{
    public class MatchmakingResultViewModel : ViewModel
    {
        public string GameNumber { get; private set; }
        public string Challenge { get; private set; }
        public string InitialTroops { get; private set; }
        public string PlayOrder { get; private set; }
        public string GameType { get; private set; }
        public string Spoils { get; private set; }
        public string Reinforcements { get; private set; }
        public string FogOfWar { get; private set; }
        public string TrenchWarfare { get; private set; }
        public ObservableCollection<MatchmakingResultPlayerViewModel> Players { get; private set; }

        public MatchmakingResultViewModel(API.Game game)
        {
            Players = new ObservableCollection<MatchmakingResultPlayerViewModel>();
            GameNumber = game.GameNumber;
            Challenge = "Unknown";
            InitialTroops = game.Troops.ToString();
            PlayOrder = game.Order.ToString();
            GameType = game.Type.ToString();
            Spoils = game.BonusCards.ToString();
            Reinforcements = game.Fortification.ToString();
            FogOfWar = game.WarFog == Query.Yes ? "Yes" : "No";
            TrenchWarfare = game.TrenchWarfare == Query.Yes ? "Yes" : "No";

            foreach(GamePlayer p in game.Players.Players)
                Players.Add(new MatchmakingResultPlayerViewModel(p.Name, p.Meta));
        }
    }
}
